
CROSS_COMPILE 	?= arm-linux-gnueab- 
OBJNAME 		?= ledc


OBJS 	:= start.o main.o
GCC 	:= $(CROSS_COMPILE)gcc
LD 		:= $(CROSS_COMPILE)ld
OBJCOPY := $(CROSS_COMPILE)objcopy
OBJDUMP := $(CROSS_COMPILE)objdump


$(OBJNAME).bin : $(OBJS)
	$(LD) -Timx6u.lds -o $(OBJNAME).elf $^
	$(OBJCOPY) -O binary -S $(OBJNAME).elf $@
	$(OBJDUMP) -D -m arm $(OBJNAME).elf > $(OBJNAME).dis

%.o : %.c
	$(GCC) -Wall -nostdlib -c -O2 -o $@ $<
	
%.o : %.S
	$(GCC) -Wall -nostdlib -c -O2 -o $@ $<

clean :
	rm -rf *.o $(OBJNAME).bin $(OBJNAME).elf $(OBJNAME).dis

